#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../../NetEngine_Linux/NetEngine_SourceCode/XyRyNet_CommHdr.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/XyRyNet_Types.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/NetEngine_Lib/NetEngine_Algorithm/Algorithm_Define.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/NetEngine_Lib/NetEngine_Algorithm/Algorithm_Error.h"

//g++ -std=gnu++11 -Wall -g Test_Algorithm.cpp -o Test_Algorithm -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib -lNetEngine_Algorithm -Wl,-rpath=../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib

int main()
{
    int nPos = 0;
    LPCTSTR lpszSourceStr = _T("123hel54124hello666");
    LPCTSTR lpszFindStr = _T("hell");
    if (Algorithm_String_XFastMatch(lpszSourceStr, lpszFindStr, &nPos))
    {
        printf("Algorithm_String_XFastMatch:%d\n", nPos);
    }

    int nSwapA = 100;
    int nSwapB = 200;
    if (Algorithm_Math_Swap(&nSwapA, &nSwapB))
    {
        printf("%d = %d\n", nSwapA, nSwapB);
    }

    __int64 nArrayKey = 123456;
    __int64 nArrayValue[6];
    if (Algorithm_Math_GetValue(nArrayKey, nArrayValue))
    {
        for (int i = 0;i < 6;i++)
        {
            printf("%lld\n", nArrayValue[i]);
        }
    }

    int nInBit = 10;
    int nOutBit = 0;
    if (Algorithm_Math_GetBit(&nInBit,3,&nOutBit))
    {
        printf("%d\n", nOutBit);
    }

    if (Algorithm_Math_SetBit(&nInBit, 4, 7))
    {
        printf("%d\n", nInBit);
    }
    return 0;
}
